package com.cangxuan.manage.dao;

import com.cangxuan.manage.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 商品DAO
 */
@Mapper
public interface IGoodsDao {

    List<Goods> select(@Param("pageIndex") int pageIndex,
                       @Param("pageSize") int pageSize,
                       @Param("seriesId") Integer seriesId,
                       @Param("name") String name,
                       @Param("code") String code);

    int selectCount(@Param("seriesId") Integer seriesId,
                    @Param("name") String name,
                    @Param("code") String code);


    Goods selectById(Integer id);

    int insert(Goods goods);

    int update(Goods goods);

    int delete(int id);
    @Select("select count(0) from goods where series_id=#{seriesId}")
    int selectCountBySeriesId(@Param("seriesId") int seriesId);

}
